package xworker.gluon.attach;

import com.gluonhq.attach.display.DisplayService;
import org.xmeta.ActionContext;

public class DisplayActions {
    public static Object getDefaultDimensions(ActionContext actionContext){
        DisplayService service = DisplayService.create().orElse(null);
        if(service != null){
            return service.getDefaultDimensions();
        }else{
            return null;
        }
    }

    public static Object getScreenResolution(ActionContext actionContext){
        DisplayService service = DisplayService.create().orElse(null);
        if(service != null){
            return service.getScreenResolution();
        }else{
            return null;
        }
    }

    public static boolean hasNotch(ActionContext actionContext){
        DisplayService service = DisplayService.create().orElse(null);
        if(service != null){
            return service.hasNotch();
        }else{
            return false;
        }
    }

    public static Object notchProperty(ActionContext actionContext){
        DisplayService service = DisplayService.create().orElse(null);
        if(service != null){
            return service.notchProperty();
        }else{
            return null;
        }
    }
    public static float getScreenScale(ActionContext actionContext){
        DisplayService service = DisplayService.create().orElse(null);
        if(service != null){
            return service.getScreenScale();
        }else{
            return 0f;
        }
    }

    public static boolean isDesktop(ActionContext actionContext){
        DisplayService service = DisplayService.create().orElse(null);
        if(service != null){
            return service.isDesktop();
        }else{
            return true;
        }
    }

    public static boolean isPhone(ActionContext actionContext){
        DisplayService service = DisplayService.create().orElse(null);
        if(service != null){
            return service.isPhone();
        }else{
            return false;
        }
    }

    public static boolean isScreenRound(ActionContext actionContext){
        DisplayService service = DisplayService.create().orElse(null);
        if(service != null){
            return service.isScreenRound();
        }else{
            return false;
        }
    }

    public static boolean isTablet(ActionContext actionContext){
        DisplayService service = DisplayService.create().orElse(null);
        if(service != null){
            return service.isTablet();
        }else{
            return false;
        }
    }
}
